<div class="content">

    <div class="panel panel-default panel-intro">
        <div class="panel-body">
            <div id="" class="tab-content">
                <div class="tab-pane fade active in" id="one">
                    <div class="widget-body no-padding">
                        <div class="bootstrap-table">
                            <div class="fixed-table-toolbar">
                                <table id="" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
                                    <thead>
                                        <tr>
                                            <th style="text-align: center; vertical-align: middle;width:5%;height: 45px;" data-field="id">
                                                <div class="th-inner ">天数ID</div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:5%;" data-field="fid">
                                                <div class="th-inner ">产品ID</div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:5%;" data-field="title">
                                                <div class="th-inner ">天数</div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:70%;" data-field="type">
                                                <div class="th-inner ">天数标题</div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:15%;" data-field="operate">
                                                <div class="th-inner ">操作</div>
                                            </th>
                                        </tr>
                                    </thead>
                                    <form action="" method="post" id="sort_f">

                                        <tbody data-listidx="0">
                                        {volist name="list" id="vo"}
                                            <tr>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.id}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.p_id}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.day_no}</td>
                                                <td style="text-align: center; vertical-align: middle; ">
                                                    <div style="line-height:30px;background:#3498db;color:#fff;">
                                                        {$vo.titlearr}
                                                    </div>
                                                    <div>
                                                        {if $vo['selfpay']}
                                                            <table id="" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
                                                                <thead style="background:#f1cf99;">
                                                                <tr>
                                                                    <th style="text-align: center; vertical-align: middle;width:10%;height: 30px;" data-field="id">
                                                                        <div class="th-inner ">ID</div>
                                                                    </th>
                                                                    <th style="text-align: center; vertical-align: middle;width:40%;" data-field="fid">
                                                                        <div class="th-inner ">自费标题</div>
                                                                    </th>
                                                                    <th style="text-align: center; vertical-align: middle;width:10%;" data-field="type">
                                                                        <div class="th-inner ">实施价格</div>
                                                                    </th>
                                                                    <th style="text-align: center; vertical-align: middle;width:10%;" data-field="type">
                                                                        <div class="th-inner ">儿童价</div>
                                                                    </th>
                                                                    <th style="text-align: center; vertical-align: middle;width:10%;" data-field="type">
                                                                        <div class="th-inner ">折扣%</div>
                                                                    </th>
                                                                    <th style="text-align: center; vertical-align: middle;width:20%;" data-field="operate">
                                                                        <div class="th-inner ">操作</div>
                                                                    </th>
                                                                </tr>
                                                                </thead>
                                                                <tbody data-listidx="0">
                                                                {volist name='vo.selfpay' id='pay' key="j"}
                                                                <tr style="background:#d4efe0;">
                                                                    <td style="text-align: center; vertical-align: middle; ">
                                                                        {$pay.selfpay_id}
                                                                    </td>
                                                                    <td style="text-align: center; vertical-align: middle; ">
                                                                        {$pay.selfpay_p_name}
                                                                    </td>
                                                                    <td style="text-align: center; vertical-align: middle; ">
                                                                        {$pay.selfpay_price}
                                                                    </td>
                                                                    <td style="text-align: center; vertical-align: middle; ">
                                                                        {$pay.selfpay_childrenprice}
                                                                    </td>
                                                                    <td style="text-align: center; vertical-align: middle; ">
                                                                        {$pay.selfpay_discount}
                                                                    </td>
                                                                    <td style="text-align: center; vertical-align: middle; ">
                                                                        <a href="javasrcipt:void;" id="{$pay.selfpay_id}" class="btn btn-success btn-edit btn-disabled" title="编辑">
                                                                            <i class="fa fa-pencil"></i>编辑
                                                                        </a>
                                                                        <a href="javasrcipt:void;" id="{$pay.selfpay_id}" class="btn btn-danger btn-del btn-disabled" title="删除">
                                                                            <i class="fa fa-trash"></i> 删除
                                                                        </a>
                                                                    </td>
                                                                </tr>
                                                                {/volist}
                                                                </tbody>
                                                            </table>
                                                        {/if}
                                                    </div>
                                                </td>
                                                <td style="text-align: center; vertical-align: middle; ">
                                                    <a href="javascript:void ;" id="{$vo.id}"  p_id="{$vo.p_id}" class="btn btn-success btn-add " title="添加">
                                                        <i class="fa fa-plus"></i> 自费项目
                                                    </a>
                                                </td>
                                            </tr>
                                        {/volist}
                                        </tbody>
                                    </form>
                                </table>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="/assets/libs/fastadmin-layer/dist/layer.js"></script>

<script>
    /**添加自费项目**/
    $(".btn-add").click(function () {
        var id = $(this).attr("id");
        var pid = $(this).attr("p_id");
        layer.open({
            type: 2,
            title: '自费项目',
            maxmin: true,
            area: ['800px', '650px'],
            content: '/admin/product/product_zf_add?id='+id+"&pid="+pid,
            end: function(){}
        });
    })
    /**编辑自费项目**/
    $(".btn-edit").click(function () {
        var id = $(this).attr("id");
        layer.open({
            type: 2,
            title: '编辑自费项目',
            maxmin: true,
            area: ['600px', '450px'],
            content: '/admin/product/edit_zf?id='+id,
            end: function(){}
        });
    })
    /**删除自费项目**/
    $(".btn-del").click(function () {
        var is_true = confirm("确认要删除此自费项目？");
        var id = $(this).attr("id");
        if(true == is_true){
            $.ajax({
                type:"POST",
                url:"/admin/product/del_zf",
                data:{id:id},
                dataType:"html",
                success:function(data){
                    if(data==1){
                        alert("删除成功！");
                        location.reload();
                    }else {
                        alert("删除失败！");
                    }
                }
            });
        }
    })
</script>